package com.demo.server.utils;


import java.io.InputStream;
import java.util.Properties;
/**
 * @Author : liws
 * @Date : 2024/7/4 23:55
 * @Description :
 */
public class ApplicationProperties {

    private static final Properties properties = new Properties();

    static {
        try {
            InputStream inputStream = ApplicationProperties.class.getClassLoader().getResourceAsStream("application.properties");
            if (inputStream != null) {
                properties.load(inputStream);
            } else {
                throw new RuntimeException("Could not find application.properties");
            }
        } catch (Exception e) {
            throw new RuntimeException("Error loading application.properties", e);
        }
    }

    public static String getProperty(String key) {
        return properties.getProperty(key);
    }
}